package com.ruoyi.material.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.material.domain.MateImport;
import com.ruoyi.material.domain.MateProductDetail;
import com.ruoyi.material.mapper.MateImportMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author
 * @Version 1.0
 */
@RestController
@RequestMapping("/mateimport")
public class MateImportController extends BaseController {
    @Autowired
    MateImportMapper mateImportMapper;


    /*
     全部的原材料入库信息单
      */
    @GetMapping("/selectImports")
    public TableDataInfo selectImports() {
        startPage();
        List<MateImport> imports = mateImportMapper.selectImports(SecurityUtils.getDeptId());
        return getDataTable(imports);
    }


    /*
查询已经做完的原材料入库信息单
     */
    @GetMapping("/selectEdit")
    public Map<String, Object> selectEdit(@RequestParam(value = "importId", required = false) Long importId) {
        Map<String, Object> result = new HashMap<>();
        MateImport mateImport = mateImportMapper.selectMateImport(importId);
        result.put("mateImport", mateImport);
        return result;
    }

}
